import { ProductCategory2Type, ProductCategory3Type } from '/@/util/product-type';

import { DataTimeSelectEnum, DataTimeListEnum } from '/@/enums/productEnum';

export const SandstormList: ProductCategory2Type[] = [
  {
    category1: 'sandstorm',
    category2: 'sandstorm-cma',
    label: 'CMA沙尘预报',
    title: 'CMA沙尘预报',
    defaultItemKey: 'szms#cma#SCONC_DUST',
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-kma',
    label: 'KMA沙尘预报',
    title: 'KMA沙尘预报',
    defaultItemKey: 'szms#kma#SCONC_DUST',
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-jma',
    label: 'JMA沙尘预报',
    title: 'JMA沙尘预报',
    defaultItemKey: 'szms#jma#SCONC_DUST',
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-fmi',
    label: 'FMI沙尘预报',
    title: 'FMI沙尘预报',
    defaultItemKey: 'szms#fmi#SCONC_DUST',
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-ecmwf',
    label: 'ECMWF沙尘预报',
    title: 'ECMWF沙尘预报',
    defaultItemKey: 'szms#ec#AOD550_DUST',
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-ncep',
    label: 'NCEP沙尘预报',
    title: 'NCEP沙尘预报',
    defaultItemKey: 'szms#ncep',
  },
];

export const ProductList: ProductCategory3Type[] = [
  {
    category1: 'sandstorm',
    category2: 'sandstorm-cma',
    itemKey: 'szms#cma#SCONC_DUST',
    label: '地表沙尘浓度',
    title: '地表沙尘浓度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-cma',
    itemKey: 'szms#cma#AOD550_DUST',
    label: '气溶胶光学厚度',
    title: '气溶胶光学厚度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-cma',
    itemKey: 'szms#cma#LOAD_DUST',
    label: '排放通量',
    title: '排放通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-cma',
    itemKey: 'szms#cma#WDEPO_DUST',
    label: '湿沉降通量',
    title: '湿沉降通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-cma',
    itemKey: 'szms#cma#DDEPO_DUST',
    label: '干沉降通量',
    title: '干沉降通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },

  {
    category1: 'sandstorm',
    category2: 'sandstorm-kma',
    itemKey: 'szms#kma#SCONC_DUST',
    label: '地表沙尘浓度',
    title: '地表沙尘浓度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-kma',
    itemKey: 'szms#kma#AOD550_DUST',
    label: '气溶胶光学厚度',
    title: '气溶胶光学厚度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-kma',
    itemKey: 'szms#kma#LOAD_DUST',
    label: '排放通量',
    title: '排放通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-kma',
    itemKey: 'szms#kma#WDEPO_DUST',
    label: '湿沉降通量',
    title: '湿沉降通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-kma',
    itemKey: 'szms#kma#DDEPO_DUST',
    label: '干沉降通量',
    title: '干沉降通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },

  {
    category1: 'sandstorm',
    category2: 'sandstorm-jma',
    itemKey: 'szms#jma#SCONC_DUST',
    label: '地表沙尘浓度',
    title: '地表沙尘浓度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-jma',
    itemKey: 'szms#jma#AOD550_DUST',
    label: '气溶胶光学厚度',
    title: '气溶胶光学厚度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-jma',
    itemKey: 'szms#jma#LOAD_DUST',
    label: '排放通量',
    title: '排放通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-jma',
    itemKey: 'szms#jma#WDEPO_DUST',
    label: '湿沉降通量',
    title: '湿沉降通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-jma',
    itemKey: 'szms#jma#DDEPO_DUST',
    label: '干沉降通量',
    title: '干沉降通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },

  {
    category1: 'sandstorm',
    category2: 'sandstorm-fmi',
    itemKey: 'szms#fmi#SCONC_DUST',
    label: '地表沙尘浓度',
    title: '地表沙尘浓度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-fmi',
    itemKey: 'szms#fmi#AOD550_DUST',
    label: '气溶胶光学厚度',
    title: '气溶胶光学厚度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-fmi',
    itemKey: 'szms#fmi#WDEPO_DUST',
    label: '湿沉降通量',
    title: '湿沉降通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-fmi',
    itemKey: 'szms#fmi#DDEPO_DUST',
    label: '干沉降通量',
    title: '干沉降通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },

  {
    category1: 'sandstorm',
    category2: 'sandstorm-fmi',
    itemKey: 'szms#ec#SCONC_DUST',
    label: '地表沙尘浓度',
    title: '地表沙尘浓度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-ecmwf',
    itemKey: 'szms#ec#AOD550_DUST',
    label: '气溶胶光学厚度',
    title: '气溶胶光学厚度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-ecmwf',
    itemKey: 'szms#ec#WDEPO_DUST',
    label: '湿沉降通量',
    title: '湿沉降通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-ecmwf',
    itemKey: 'szms#ec#DDEPO_DUST',
    label: '干沉降通量',
    title: '干沉降通量',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
  {
    category1: 'sandstorm',
    category2: 'sandstorm-ncep',
    itemKey: 'szms#ncep',
    label: '地表沙尘浓度',
    title: '地表沙尘浓度',
    dataTimeSelectType: DataTimeSelectEnum.HOURS,
    dataTimeListType: DataTimeListEnum.HOUR_LIST,
  },
];

export const getProductList12 = (category1: string, category2: string, size: number) => {
  const results: ProductCategory3Type[] = [];
  for (const item in ProductList) {
    if (size > 0 && results.length >= size) {
      return results;
    }
    if (ProductList[item].category1 == category1 && ProductList[item].category2 == category2) {
      results.push(ProductList[item]);
    }
  }
  return results;
};

export const getProductList1 = (category1: string, size: number) => {
  const results: ProductCategory3Type[] = [];
  for (const item in ProductList) {
    if (size > 0 && results.length >= size) {
      return results;
    }
    if (ProductList[item].category1 == category1) {
      results.push(ProductList[item]);
    }
  }
  return results;
};

export const getProductByItemKey = (itemKey: string) => {
  for (const i in ProductList) {
    if (ProductList[i].itemKey === itemKey) {
      return ProductList[i];
    }
  }
};
